package expriment4_T2_T3;

public class T2 {
        public static void main(String[] args) {
            int a = 10;
            int b = 20;
            Demo d = new Demo();
            int result = d.sum(a, b);// 基本类型作参数传递
            System.out.println(result);
            System.out.println("---------------------------");
            StudentDemo sd = new StudentDemo();
            Student s = new Student();
            sd.method(s);            // 引用类型作参数传递
        }
    }
    //形式参数是基本类型
    class Demo {
        public int sum(int a, int b) {
            return a + b;
        }
    }
    //Student是一个引用类型，相当于基本类型中的某个类型，比如int
    class Student {
        public void show() {
            System.out.println("我们爱Java！");
        }
    }
    //形式参数是引用类型
    class StudentDemo {
        public void method(Student s) {
            s.show();
        }

}
